package com.mowh.gof23.creational.patterns.singleton;

public class DoubleCheckedLockingSingleton {

    private volatile static DoubleCheckedLockingSingleton uniqueDoubleCheckedLockingSingleton;
    private DoubleCheckedLockingSingleton() {};

    public DoubleCheckedLockingSingleton getDoubleCheckedLockingSingleton() {
        if(null == uniqueDoubleCheckedLockingSingleton) {
            synchronized (DoubleCheckedLockingSingleton.class) {
                if(null == uniqueDoubleCheckedLockingSingleton) {
                    uniqueDoubleCheckedLockingSingleton = new DoubleCheckedLockingSingleton();
                }
            }
        }
        return uniqueDoubleCheckedLockingSingleton;
    };
}
